package ZRH;

public class zrh06 {
    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6, 7, 8};
        System.out.println(isEven(5, arr));
        System.out.println(isEven(10, arr));
    }

    public static boolean isEven(int num, int[] arr) {
        //定义计数器，记录存在情况，最后根据是否存在给出返回值
        int count = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == num) {
                count++;
            }
        }
        if (count == 0) {
            return false;
        } else {
            return true;
        }
    }
}
